package biz.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import dao.EvectionDao;
import entity.Car;
import entity.Evection;
import biz.EvectionBiz;

public class EvectionBizImpl implements EvectionBiz {
	private EvectionDao evectionDao;

	public List<Evection> findAll(Integer id) {
		return evectionDao.findAll(id);
	}

	public Evection findById(Integer id) {
		return evectionDao.findById(id);
	}

	public int add(Evection evection) {
		try {
			evectionDao.add(evection);
			return 1;
		} catch (Exception e) {
			e.printStackTrace();
			return -1;
		}
	}

	public int delete(Evection evection) {
		return evectionDao.delete(evection);
	}

	public int update(Evection evection) {
		return evectionDao.update(evection);
	}

	public List<Evection> findByParam(Map map) {
		// TODO Auto-generated method stub
		return null;
	}

	
	
	
	public EvectionDao getEvectionDao() {
		return evectionDao;
	}

	public void setEvectionDao(EvectionDao evectionDao) {
		this.evectionDao = evectionDao;
	}
	public Integer count(){
		return evectionDao.count();
	}
	public List<Evection> findByPage(Integer pageNo, Integer rows){
		Map map = new HashMap();
		map.put("start", (pageNo-1)*rows+1);
		map.put("end", pageNo*rows);
		return evectionDao.findByPage(map);
	}
	
}
